/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actions;

import beans.ObraSocialBean;
import daos.Dao;
import daos.DaoFactory;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author C
 */
public class MostrarTurnosDisponibleAction extends Action{

    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) {
        HttpSession sesion = request.getSession(true);         
        String os = (String) sesion.getAttribute("nom_os");        
        try {     
            Dao dao = DaoFactory.getDao("Prestadora"); 
            ArrayList lista = (ArrayList) dao.select(new ObraSocialBean(os));            
            request.setAttribute("listaPrestadoras", lista);                      
            request.setAttribute("listaTurnos", null); 
            sesion.setAttribute("listaPrestadoras", lista);   
        } catch (Exception ex) { 
            request.setAttribute("Error", ex.getMessage());
            System.out.println("Error    " + ex.getMessage());
        }
        finally {
            this.gotoPage("/buscarturno.jsp", request, response);
        }    
    }    
}
